using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class AbilitySetByLevelLabel : MonoBehaviour {
	
	public UILabel level;
	public int levelNum;
	public UILabel abilitiesLabel;
	
	public GameObject target;
	public GameObject BrowseSelectSearchWindowPrefab;
	public string functionName;
	
	public List<string> abilities;
	
	public GameObject NewAbilityWindowPrefab;
	
	public Dictionary<string, bool> typeCheckDict;

	// Use this for initialization
	void Start () {
		UIButtonMessage message = gameObject.AddComponent<UIButtonMessage>();
		message.target = gameObject;
		message.functionName = "Clicked";
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	void Clicked()
	{
		BrowserManager.CreateAbilityBrowser(gameObject, "UpdateAbilityLists", abilities, true,true);
	}
	
	public void UpdateAbilityLists(List<string> selections)
	{
		abilities = selections;
		
		abilitiesLabel.text = "";
		
		if(selections != null)
			foreach(string ability in selections)
			{
				if(abilitiesLabel.text != "")
					abilitiesLabel.text = abilitiesLabel.text + ", "; 
				abilitiesLabel.text = abilitiesLabel.text + HelperFunctions.getRealName(ability, HelperFunctions.ObjectType.ABILITY);
			}
		
		if(target != null)
		{
			target.SendMessage(functionName, this, SendMessageOptions.DontRequireReceiver);
		}
	}
		
}
